package com.office.anywher.global;

import java.util.HashMap;
import java.util.Map;

/**
 * unique variable single model
 * 
 * @author Administrator
 * 
 */
public class GlobalVar {
	private static Map<String, Object> mVar = new HashMap<String, Object>();
	private static GlobalVar mGlobalVar ;
	private static int id = 0;
	private GlobalVar() {
	}
	public synchronized static int getId(){
		return id++;
	}
	public synchronized static GlobalVar getInstance() {
		if(mGlobalVar==null){
			mGlobalVar = new GlobalVar();
		}
		return mGlobalVar;
	}

	public synchronized void put(String key, Object obj) {
		mVar.put(key, obj);
	}

	public synchronized Object get(String key) {
		if (mVar.containsKey(key)) {
			return mVar.get(key);
		}
		return null;
	}
}
